<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function unique(array) {
            return Array.from(new Set(array));
        }
        // 或者写成（建议写法）
        const unique = arr => [...new Set(arr)];
        // 也可以是
        const unique = arr => {
            return [...new Set(arr)];
        }

        var arr = ['aa', , '', 1, 0, '1', 1, , null, undefined, null];
        console.log(unique(arr));
    </script>
</body>

</html>